package com.chencong.source;

import com.chencong.env.FlinkTableEnv;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Author chencong
 * @Description 端口读取
 * @Date 8:06 下午 2021/8/16
 * @Param
 **/
public class SourceSocket {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment streamTableEnvironment = FlinkTableEnv.getStreamTableEnvironment();

        DataStreamSource<String> stringDataStreamSource = streamTableEnvironment.socketTextStream("localhost", 9999);

        stringDataStreamSource.print();
        streamTableEnvironment.execute();
    }
}
